#ifndef __PUBLIC_H_
#define __PUBLIC_H_
#include <unordered_map>

static const int PIPE_BUF_LEN =2;
static const int SMALL_BUF_LEN = 128;//尽量写成2的幂次，这样在内存中读数据时可以一次读完
static const int MEDIUM_BUF_LEN =512;
static const int LAGE_BUF_LEN =1024;
static const int BIG_LAGE_BUF_LEN =4096;
enum COLOR_NUMBER{
   DEFAULT_COLOR = 0,
   INFO_COLOR = 36,
   ERROR_COLOR =35,
   DEBUG_COLOR =32,
   FATAL_COLOR = 31,
   LINE_COLOR=32,
   FUNCTION_COLOR=34,
   FILE_COLOR=35,
};
enum LOG_LEVEL{
    INFO = 0,
    ERROR,
    DEBUG,
    FATAL
};
enum LOG_FEILD{
    LINE_NUMBER =0,
    FUNCTION_NAME,
    FILE_NAME
};
//unordered_map表 存取  查找时间复杂度O(1)

//存放每个级别对应的颜色
static std::unordered_map<LOG_LEVEL,COLOR_NUMBER> LogLevelColor ={
    {INFO,INFO_COLOR},
    {ERROR,ERROR_COLOR},
    {DEBUG,DEBUG_COLOR},
    {FATAL,FATAL_COLOR}
};
//存放行，文件，函数字段对应的色号
static std::unordered_map<LOG_FEILD,COLOR_NUMBER> LogFiledColor ={
    {LINE_NUMBER, LINE_COLOR},
    {FUNCTION_NAME, FUNCTION_COLOR},
    {FILE_NAME,FILE_COLOR}
};
//存放日志级别对应的字符串
static std::unordered_map<LOG_LEVEL,std::string> LogLevelString ={
  {INFO,"[INFO]"},
  {ERROR,"[ERROR]"},
  {DEBUG,"[DEBUG]"},
  {FATAL,"[FATAL]"}
};
static std::unordered_map<std::string,LOG_LEVEL> LogLevelType ={
  {"[INFO]",INFO},
  {"[ERROR]",ERROR},
  {"[DEBUG]",DEBUG},
  {"[FATAL]",FATAL}
};
#endif